home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 5 / Amiga Tools 5.iso / tools / developer-tools / aros / source / exec / internal / m68k / setsr.s < prev    next >
Encoding:
Text File  |  1996-07-16  |  1.1 KB  |  67 lines

  1. |*****************************************************************************
  2. |
  3. |   NAME
  4. |
  5. |    __AROS_LH2(ULONG, SetSR,
  6. |
  7. |   SYNOPSIS
  8. |    __AROS_LA(ULONG, newSR, D0),
  9. |    __AROS_LA(ULONG, mask,  D1),
  10. |
  11. |   LOCATION
  12. |    struct ExecBase *, SysBase, 24, Exec)
  13. |
  14. |   FUNCTION
  15. |    Read/Modify the CPU status register in an easy way. Only the bits set in
  16. |    the mask parameter will be changed.
  17. |
  18. |   INPUTS
  19. |    newSR - New contents of sr.
  20. |    mask  - Bits to change.
  21. |
  22. |   RESULT
  23. |    Old contents of sr.
  24. |
  25. |   NOTES
  26. |
  27. |   EXAMPLE
  28. |
  29. |   BUGS
  30. |
  31. |   SEE ALSO
  32. |
  33. |   INTERNALS
  34. |
  35. |   HISTORY
  36. |
  37. |******************************************************************************
  38.  
  39.     Supervisor  =    -0x1e
  40.  
  41.     .globl    _Exec_SetSR
  42. _Exec_SetSR:
  43.     | Do the real work in supervisor mode
  44.     | Preserve a5 in a0 (faster than stack space)
  45.     movel    a5,a0
  46.     leal    setsrsup,a5
  47.     jsr    a6@(Supervisor)
  48.     movel    a0,a5
  49.     rts
  50.  
  51. setsrsup:
  52.     | The old value of sr now lies on the top of the stack.
  53.     | d1 = (mask & newSR) | (~mask & SR)
  54.     andw    d1,d0
  55.     eorw    #-1,d1
  56.     andw    sp@,d1
  57.     orw    d0,d1
  58.  
  59.     | Get returncode
  60.     clrl    d0
  61.     movew    sp@,d0
  62.  
  63.     | Set new sr value
  64.     movew    d1,sp@
  65.     rte
  66.  
  67.